using System.ComponentModel.DataAnnotations;

namespace Rabbit3.Api.Dto
{
    /// <summary>
    /// 深加工信息创建DTO
    /// </summary>
    public class CreateProcessingDto
    {
        /// <summary>
        /// 溯源信息ID
        /// </summary>
        [Required(ErrorMessage = "溯源信息ID不能为空")]
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 班组
        /// </summary>
        [Required(ErrorMessage = "班组不能为空")]
        [StringLength(50, ErrorMessage = "班组长度不能超过50个字符")]
        public string Team { get; set; } = string.Empty;

        /// <summary>
        /// 加工日期
        /// </summary>
        [Required(ErrorMessage = "加工日期不能为空")]
        public DateTime ProcessingDate { get; set; }

        /// <summary>
        /// 加工负责人
        /// </summary>
        [Required(ErrorMessage = "加工负责人不能为空")]
        [StringLength(30, ErrorMessage = "加工负责人长度不能超过30个字符")]
        public string ProcessingManager { get; set; } = string.Empty;

        /// <summary>
        /// 加工工艺
        /// </summary>
        [StringLength(200, ErrorMessage = "加工工艺长度不能超过200个字符")]
        public string? ProcessingMethod { get; set; }

        /// <summary>
        /// 食品安全信息URL
        /// </summary>
        [StringLength(500, ErrorMessage = "食品安全信息URL长度不能超过500个字符")]
        public string? FoodSafetyInfoUrl { get; set; }

        /// <summary>
        /// 人员卫生情况URL
        /// </summary>
        [StringLength(500, ErrorMessage = "人员卫生情况URL长度不能超过500个字符")]
        public string? PersonnelHygieneUrl { get; set; }
    }

    /// <summary>
    /// 深加工信息更新DTO
    /// </summary>
    public class UpdateProcessingDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [Required(ErrorMessage = "ID不能为空")]
        public int Id { get; set; }

        /// <summary>
        /// 班组
        /// </summary>
        [Required(ErrorMessage = "班组不能为空")]
        [StringLength(50, ErrorMessage = "班组长度不能超过50个字符")]
        public string Team { get; set; } = string.Empty;

        /// <summary>
        /// 加工日期
        /// </summary>
        [Required(ErrorMessage = "加工日期不能为空")]
        public DateTime ProcessingDate { get; set; }

        /// <summary>
        /// 加工负责人
        /// </summary>
        [Required(ErrorMessage = "加工负责人不能为空")]
        [StringLength(30, ErrorMessage = "加工负责人长度不能超过30个字符")]
        public string ProcessingManager { get; set; } = string.Empty;

        /// <summary>
        /// 加工工艺
        /// </summary>
        [StringLength(200, ErrorMessage = "加工工艺长度不能超过200个字符")]
        public string? ProcessingMethod { get; set; }

        /// <summary>
        /// 食品安全信息URL
        /// </summary>
        [StringLength(500, ErrorMessage = "食品安全信息URL长度不能超过500个字符")]
        public string? FoodSafetyInfoUrl { get; set; }

        /// <summary>
        /// 人员卫生情况URL
        /// </summary>
        [StringLength(500, ErrorMessage = "人员卫生情况URL长度不能超过500个字符")]
        public string? PersonnelHygieneUrl { get; set; }
    }

    /// <summary>
    /// 深加工信息响应DTO
    /// </summary>
    public class ProcessingResponseDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 溯源信息ID
        /// </summary>
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 班组
        /// </summary>
        public string Team { get; set; } = string.Empty;

        /// <summary>
        /// 加工日期
        /// </summary>
        public DateTime ProcessingDate { get; set; }

        /// <summary>
        /// 加工负责人
        /// </summary>
        public string ProcessingManager { get; set; } = string.Empty;

        /// <summary>
        /// 加工工艺
        /// </summary>
        public string? ProcessingMethod { get; set; }

        /// <summary>
        /// 食品安全信息URL
        /// </summary>
        public string? FoodSafetyInfoUrl { get; set; }

        /// <summary>
        /// 人员卫生情况URL
        /// </summary>
        public string? PersonnelHygieneUrl { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }

        /// <summary>
        /// 企业信息
        /// </summary>
        public EnterpriseResponseDto? EnterpriseInfo { get; set; }

        /// <summary>
        /// 供应商信息列表
        /// </summary>
        public List<SupplierResponseDto> SupplierInfos { get; set; } = new List<SupplierResponseDto>();
    }

    /// <summary>
    /// 屠宰信息创建DTO
    /// </summary>
    public class CreateSlaughterDto
    {
        /// <summary>
        /// 溯源信息ID
        /// </summary>
        [Required(ErrorMessage = "溯源信息ID不能为空")]
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 批次
        /// </summary>
        [Required(ErrorMessage = "批次不能为空")]
        [StringLength(20, ErrorMessage = "批次长度不能超过20个字符")]
        public string Batch { get; set; } = string.Empty;

        /// <summary>
        /// 到厂时间
        /// </summary>
        [Required(ErrorMessage = "到厂时间不能为空")]
        public DateTime ArrivalTime { get; set; }

        /// <summary>
        /// 屠宰负责人
        /// </summary>
        [Required(ErrorMessage = "屠宰负责人不能为空")]
        [StringLength(30, ErrorMessage = "屠宰负责人长度不能超过30个字符")]
        public string SlaughterManager { get; set; } = string.Empty;

        /// <summary>
        /// 屠宰检验URL
        /// </summary>
        [StringLength(500, ErrorMessage = "屠宰检验URL长度不能超过500个字符")]
        public string? SlaughterInspectionUrl { get; set; }

        /// <summary>
        /// 检疫检验URL
        /// </summary>
        [StringLength(500, ErrorMessage = "检疫检验URL长度不能超过500个字符")]
        public string? QuarantineInspectionUrl { get; set; }
    }

    /// <summary>
    /// 屠宰信息更新DTO
    /// </summary>
    public class UpdateSlaughterDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [Required(ErrorMessage = "ID不能为空")]
        public int Id { get; set; }

        /// <summary>
        /// 批次
        /// </summary>
        [Required(ErrorMessage = "批次不能为空")]
        [StringLength(20, ErrorMessage = "批次长度不能超过20个字符")]
        public string Batch { get; set; } = string.Empty;

        /// <summary>
        /// 到厂时间
        /// </summary>
        [Required(ErrorMessage = "到厂时间不能为空")]
        public DateTime ArrivalTime { get; set; }

        /// <summary>
        /// 屠宰负责人
        /// </summary>
        [Required(ErrorMessage = "屠宰负责人不能为空")]
        [StringLength(30, ErrorMessage = "屠宰负责人长度不能超过30个字符")]
        public string SlaughterManager { get; set; } = string.Empty;

        /// <summary>
        /// 屠宰检验URL
        /// </summary>
        [StringLength(500, ErrorMessage = "屠宰检验URL长度不能超过500个字符")]
        public string? SlaughterInspectionUrl { get; set; }

        /// <summary>
        /// 检疫检验URL
        /// </summary>
        [StringLength(500, ErrorMessage = "检疫检验URL长度不能超过500个字符")]
        public string? QuarantineInspectionUrl { get; set; }
    }

    /// <summary>
    /// 屠宰信息响应DTO
    /// </summary>
    public class SlaughterResponseDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 溯源信息ID
        /// </summary>
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 批次
        /// </summary>
        public string Batch { get; set; } = string.Empty;

        /// <summary>
        /// 到厂时间
        /// </summary>
        public DateTime ArrivalTime { get; set; }

        /// <summary>
        /// 屠宰负责人
        /// </summary>
        public string SlaughterManager { get; set; } = string.Empty;

        /// <summary>
        /// 屠宰检验URL
        /// </summary>
        public string? SlaughterInspectionUrl { get; set; }

        /// <summary>
        /// 检疫检验URL
        /// </summary>
        public string? QuarantineInspectionUrl { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }

        /// <summary>
        /// 企业信息
        /// </summary>
        public EnterpriseResponseDto? EnterpriseInfo { get; set; }
    }

    /// <summary>
    /// 供应商信息创建DTO
    /// </summary>
    public class CreateSupplierDto
    {
        /// <summary>
        /// 溯源信息ID
        /// </summary>
        [Required(ErrorMessage = "溯源信息ID不能为空")]
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 供应商类型 (原料/辅料)
        /// </summary>
        [Required(ErrorMessage = "供应商类型不能为空")]
        [StringLength(20, ErrorMessage = "供应商类型长度不能超过20个字符")]
        public string SupplierType { get; set; } = string.Empty;

        /// <summary>
        /// 供应商名称
        /// </summary>
        [Required(ErrorMessage = "供应商名称不能为空")]
        [StringLength(100, ErrorMessage = "供应商名称长度不能超过100个字符")]
        public string SupplierName { get; set; } = string.Empty;

        /// <summary>
        /// 生产批次
        /// </summary>
        [Required(ErrorMessage = "生产批次不能为空")]
        [StringLength(20, ErrorMessage = "生产批次长度不能超过20个字符")]
        public string ProductionBatch { get; set; } = string.Empty;

        /// <summary>
        /// 相关材料URL
        /// </summary>
        [StringLength(500, ErrorMessage = "相关材料URL长度不能超过500个字符")]
        public string? RelatedMaterialUrl { get; set; }
    }

    /// <summary>
    /// 供应商信息更新DTO
    /// </summary>
    public class UpdateSupplierDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [Required(ErrorMessage = "ID不能为空")]
        public int Id { get; set; }

        /// <summary>
        /// 供应商类型 (原料/辅料)
        /// </summary>
        [Required(ErrorMessage = "供应商类型不能为空")]
        [StringLength(20, ErrorMessage = "供应商类型长度不能超过20个字符")]
        public string SupplierType { get; set; } = string.Empty;

        /// <summary>
        /// 供应商名称
        /// </summary>
        [Required(ErrorMessage = "供应商名称不能为空")]
        [StringLength(100, ErrorMessage = "供应商名称长度不能超过100个字符")]
        public string SupplierName { get; set; } = string.Empty;

        /// <summary>
        /// 生产批次
        /// </summary>
        [Required(ErrorMessage = "生产批次不能为空")]
        [StringLength(20, ErrorMessage = "生产批次长度不能超过20个字符")]
        public string ProductionBatch { get; set; } = string.Empty;

        /// <summary>
        /// 相关材料URL
        /// </summary>
        [StringLength(500, ErrorMessage = "相关材料URL长度不能超过500个字符")]
        public string? RelatedMaterialUrl { get; set; }
    }

    /// <summary>
    /// 供应商信息响应DTO
    /// </summary>
    public class SupplierResponseDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 溯源信息ID
        /// </summary>
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 供应商类型 (原料/辅料)
        /// </summary>
        public string SupplierType { get; set; } = string.Empty;

        /// <summary>
        /// 供应商名称
        /// </summary>
        public string SupplierName { get; set; } = string.Empty;

        /// <summary>
        /// 生产批次
        /// </summary>
        public string ProductionBatch { get; set; } = string.Empty;

        /// <summary>
        /// 相关材料URL
        /// </summary>
        public string? RelatedMaterialUrl { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }
    }

    /// <summary>
    /// 企业信息创建DTO (通用)
    /// </summary>
    public class CreateEnterpriseDto
    {
        /// <summary>
        /// 溯源信息ID
        /// </summary>
        [Required(ErrorMessage = "溯源信息ID不能为空")]
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 企业阶段类型 (养殖/屠宰/深加工)
        /// </summary>
        [Required(ErrorMessage = "企业阶段类型不能为空")]
        [StringLength(20, ErrorMessage = "企业阶段类型长度不能超过20个字符")]
        public string StageType { get; set; } = string.Empty;

        /// <summary>
        /// 关联信息ID (养殖信息ID/屠宰信息ID/深加工信息ID)
        /// </summary>
        public int? RelatedInfoId { get; set; }

        /// <summary>
        /// 公司名称
        /// </summary>
        [Required(ErrorMessage = "公司名称不能为空")]
        [StringLength(100, ErrorMessage = "公司名称长度不能超过100个字符")]
        public string CompanyName { get; set; } = string.Empty;

        /// <summary>
        /// 生产许可证号
        /// </summary>
        [Required(ErrorMessage = "生产许可证号不能为空")]
        [StringLength(50, ErrorMessage = "生产许可证号长度不能超过50个字符")]
        public string ProductionLicenseNumber { get; set; } = string.Empty;

        /// <summary>
        /// 公司地址
        /// </summary>
        [StringLength(200, ErrorMessage = "公司地址长度不能超过200个字符")]
        public string? CompanyAddress { get; set; }

        /// <summary>
        /// 成立时间
        /// </summary>
        public DateTime? EstablishmentDate { get; set; }

        /// <summary>
        /// 公司简介
        /// </summary>
        public string? CompanyProfile { get; set; }

        /// <summary>
        /// 企业照片URL
        /// </summary>
        [StringLength(500, ErrorMessage = "企业照片URL长度不能超过500个字符")]
        public string? EnterprisePhotoUrl { get; set; }

        /// <summary>
        /// 动检证URL
        /// </summary>
        [StringLength(500, ErrorMessage = "动检证URL长度不能超过500个字符")]
        public string? AnimalQuarantineCertificateUrl { get; set; }
    }

    /// <summary>
    /// 企业信息更新DTO (通用)
    /// </summary>
    public class UpdateEnterpriseDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [Required(ErrorMessage = "ID不能为空")]
        public int Id { get; set; }

        /// <summary>
        /// 公司名称
        /// </summary>
        [Required(ErrorMessage = "公司名称不能为空")]
        [StringLength(100, ErrorMessage = "公司名称长度不能超过100个字符")]
        public string CompanyName { get; set; } = string.Empty;

        /// <summary>
        /// 生产许可证号
        /// </summary>
        [Required(ErrorMessage = "生产许可证号不能为空")]
        [StringLength(50, ErrorMessage = "生产许可证号长度不能超过50个字符")]
        public string ProductionLicenseNumber { get; set; } = string.Empty;

        /// <summary>
        /// 公司地址
        /// </summary>
        [StringLength(200, ErrorMessage = "公司地址长度不能超过200个字符")]
        public string? CompanyAddress { get; set; }

        /// <summary>
        /// 成立时间
        /// </summary>
        public DateTime? EstablishmentDate { get; set; }

        /// <summary>
        /// 公司简介
        /// </summary>
        public string? CompanyProfile { get; set; }

        /// <summary>
        /// 企业照片URL
        /// </summary>
        [StringLength(500, ErrorMessage = "企业照片URL长度不能超过500个字符")]
        public string? EnterprisePhotoUrl { get; set; }

        /// <summary>
        /// 动检证URL
        /// </summary>
        [StringLength(500, ErrorMessage = "动检证URL长度不能超过500个字符")]
        public string? AnimalQuarantineCertificateUrl { get; set; }
    }

    /// <summary>
    /// 企业信息响应DTO (通用)
    /// </summary>
    public class EnterpriseResponseDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 溯源信息ID
        /// </summary>
        public int TraceabilityId { get; set; }

        /// <summary>
        /// 企业阶段类型 (养殖/屠宰/深加工)
        /// </summary>
        public string StageType { get; set; } = string.Empty;

        /// <summary>
        /// 关联信息ID (养殖信息ID/屠宰信息ID/深加工信息ID)
        /// </summary>
        public int? RelatedInfoId { get; set; }

        /// <summary>
        /// 公司名称
        /// </summary>
        public string CompanyName { get; set; } = string.Empty;

        /// <summary>
        /// 生产许可证号
        /// </summary>
        public string ProductionLicenseNumber { get; set; } = string.Empty;

        /// <summary>
        /// 公司地址
        /// </summary>
        public string? CompanyAddress { get; set; }

        /// <summary>
        /// 成立时间
        /// </summary>
        public DateTime? EstablishmentDate { get; set; }

        /// <summary>
        /// 公司简介
        /// </summary>
        public string? CompanyProfile { get; set; }

        /// <summary>
        /// 企业照片URL
        /// </summary>
        public string? EnterprisePhotoUrl { get; set; }

        /// <summary>
        /// 动检证URL
        /// </summary>
        public string? AnimalQuarantineCertificateUrl { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }
    }
}
